/**
 * 
 */
package com.skood.security.action;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.struts2.json.JSONUtil;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.skood.platform.webapp.action.BaseAction;
import com.skood.security.domain.Role;
import com.skood.security.model.RoleSearchModel;
import com.skood.security.service.RoleService;

/**
 * @author keege
 * @date 2013-12-8
 * 角色
 */
@Controller("roleAction")
@Scope("prototype")
public class RoleAction extends BaseAction<RoleSearchModel,Role>{
	private static final long serialVersionUID = 2016769054781183534L;

	@Resource(name="roleService")
	private RoleService roleService;
	public String doJsonList()throws Exception{
		List<Role> resultList = roleService.search(searchModel, null);
		Long total = roleService.searchCount(searchModel, null);
		
		Map<String,Object> resultMap = new HashMap<String,Object>();
		resultMap.put("success", true);
		resultMap.put("rows", resultList);
		resultMap.put("total", total);
		response().setCharacterEncoding("UTF-8");
		String jsonObj = JSONUtil.serialize(resultMap);
		response().getWriter().write(jsonObj);
		
		return null;
	}
}
